SVM patch for 64bit hv, to reset the ss, es, ds host selectors to NULL
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 4 May 2006 20:24:39 +0000 (21:24 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 4 May 2006 20:24:39 +0000 (21:24 +0100)
during a context switch to the SVM domain's vcpu. This patch also
initializes the tlb_control to 1 for the initial do_launch().
Signed-off-by: Tom Woller <thomas.woller@amd.com>
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/svm/vmcb.c

index 45ecd52e72dca938ba23935afb91092a3b125939..7154f78ecfd909560a87fb3b3693b7e0510f9d8a 100644 (file)
@@ -61,6 +61,9 @@ static unsigned long trace_values[NR_CPUS][4];
 /* Useful define */
 #define MAX_INST_SIZE  15
 
+#define set_segment_register(name, value)  \
+       __asm__ __volatile__ ( "movw %%ax ,%%" STR(name) "" : : "a" (value) )
+
 /* 
  * External functions, etc. We should move these to some suitable header file(s) */
 
@@ -681,6 +684,17 @@ static void svm_ctxt_switch_from(struct vcpu *v)
 
 static void svm_ctxt_switch_to(struct vcpu *v)
 {
+#if __x86_64__
+    /* 
+     * This is required, because VMRUN does consistency check
+     * and some of the DOM0 selectors are pointing to 
+     * invalid GDT locations, and cause AMD processors
+     * to shutdown.
+     */
+    set_segment_register(ds, 0);
+    set_segment_register(es, 0);
+    set_segment_register(ss, 0);
+#endif
 }
 
 void svm_final_setup_guest(struct vcpu *v)
index 0e8abaef55f25e78581ab3e77f1ebfd729ad3900..91697b9064907cc8496c7742aff0b5e00c3ea604 100644 (file)
@@ -428,6 +428,8 @@ void svm_do_launch(struct vcpu *v)
        
     if (svm_dbg_on)
         svm_dump_vmcb(__func__, vmcb);
+
+    vmcb->tlb_control = 1;
 }